<div>
    <div id="banners" class="popup" style="background:#fff;float:right;">
        <style>
                        
                        .popup ul {
                            position: relative;
                            height: 30px;
                            z-index: 1;
                            border: 1px solid #C6C6C6;
                            -moz-border-radius: 4px 4px 4px 4px;
                            border-radius: 4px;
                            background: #E4E4E4;
                        }
                        
                        .popup ul li {
                            list-style-image: none;
                            list-style-position: outside;
                            list-style-type: none;
                            float: left;
                            line-height: 25px;
                            margin-top: 5px;
                            font-size: 12px;
                            padding: 0px 5px 0;
                        }
                        
                        .popup li.on {
                            border-top: 1px solid #C6C6C6;
                            border-left: 1px solid #C6C6C6;
                            border-right: 1px solid #C6C6C6;
                            border-bottom: -1px solid #fff;
                            -moz-border-radius: 4px 4px 0 0;
                            border-radius: 4px 4px 0 0;
                            background: #FFF;
                        }
                        
                        #list_menu, #list_content {
                            margin: 10px;
                            width: 370px;
                        }
                        
                        #list_content {
                        }
                        
                        #list_menu {
                        }
                        
                        .top_action {
                            clear: left;
                            height: 30px;
                            margin: 6px 0 7px;
                            vertical-align: middle;
                        }
                        .page{
                        	line-height:30px;
                        }
                        .page a{
                        	-moz-border-radius:5px 5px 5px 5px;
            				 border-radius:5px 5px 5px 5px
            				border:1px solid;
            				padding:3px 6px;
            				text-decoration:none;
            				background:url("") repeat-x scroll left -379px #EEEEEE;
            				border-color:#E3E3E3;
            				color:#666666;
                        }
                        
                        .right {
                            float: right
                        }
                        
                        .delete_file a{
                            cursor: pointer;
                            display: block;
                            float: right;
                            height: 10px;
                            margin: 6px 0 0 -9px;
                            overflow: hidden;
                            text-indent: -9999px;
                            width: 10px;
            				background:url("http://res.61.com/images/manage/xit.gif") no-repeat scroll 0 0 transparent;
                        }
            			.delete_file a:hover{
            				background:url("http://res.61.com/images/manage/xit.gif") no-repeat scroll -10px 0 transparent;
            			}
            			
            			#list_menu li{
            				cursor:default;
            			}
            			
                    
        </style>
        <div id="list_menu">
            <ul>
                <li tab=list class="on">
                    已上传图片
                </li>
                <li tab=upload>
                    上传图片
                </li>
                <li tab=link>
                    链接
                </li>
            </ul>
        </div>
        <div id="list_content" class="panel_content">
            <div class="top_action">
                <select name="action" class="select">
                    <option value="0">批量动作</option>
                    <option value="/admin/admin_form/delsalers">删除</option>
                </select>
                <input type="button" value="应用" id="do_btn" name="do_btn" class="input"><input id="search_txt" name="search_txt" class="input"><input type="button" value="搜索" id="filter_btn" name="filter_btn" class="input">
                <div class="page right">
                    <if $page_info.page.previous_url>
                        <a class='text' href='[@htmlspecialchars($page_info.page.previous_url)]'>上一页</a>
                    </if>
                    <foreach name="page_info.page.pages" key="key" var="var">
                        <if $var.page_num == $page_info.current_page>
                            <span title="第[@htmlspecialchars($var.page_num)]页">[@htmlspecialchars($var.page_num)]</span>
                            <else>
                            <a class="num" href="[@htmlspecialchars($var.page_link)]" title="第[@htmlspecialchars($var.page_num)]页">[@htmlspecialchars($var.page_num)]</a>
                        </if>
                    </foreach>
                    <if $page_info.page.next_url>
                        <a class='text' href='[@htmlspecialchars($page_info.page.next_url)]'>下一页</a>
                    </if>
                </div>
            </div>
            <table width="100%">
                <tbody>
                    <foreach name="result.files" var="file" key="key">
                        <tr class="table_list">
                            <td>
                            <img width="30" height="30" src="http://[$file.f_url]"/>
                            <td>
                                [@htmlspecialchars($file.f_name)]
                            </td>
                            <td>
                                [@htmlspecialchars($file.f_px)]
                            </td>
                            <td>
                                <input type="button" value="选择" id="[$file.f_id]" url="[$file.f_url]" path="[$file.f_path]" name="[$file.f_name]" class="select_file"/><span class="delete_file"><a>X</a></span>
                            </td>
                        </tr>
                    </foreach>
                </tbody>
            </table>
            <div class="top_action">
                <div class="page right">
                    <if $page_info.page.previous_url>
                        <a class='text' href='[@htmlspecialchars($page_info.page.previous_url)]'>上一页</a>
                    </if>
                    <foreach name="page_info.page.pages" key="key" var="var">
                        <if $var.page_num == $page_info.current_page>
                            <span title="第[@htmlspecialchars($var.page_num)]页">[@htmlspecialchars($var.page_num)]</span>
                            <else>
                            <a class="num" href="[@htmlspecialchars($var.page_link)]" title="第[@htmlspecialchars($var.page_num)]页">[@htmlspecialchars($var.page_num)]</a>
                        </if>
                    </foreach>
                    <if $page_info.page.next_url>
                        <a class='text' href='[@htmlspecialchars($page_info.page.next_url)]'>下一页</a>
                    </if>
                </div>
            </div>
        </div>
        <div id="upload_content" class="panel_content" style="display:none">
            <form action="/admin/admin_file/uploadfile">
                <input type="file" name="upload_file" id="upload_file"><input type="button" id="upload_file_btn" value="上传">
                <div id="file_info">
                </div>
            </form>
        </div>
        <div id="link_content" class="panel_content" style="display:none">
            http://<input type="text" name="link_url" id="link_url" size=40 ><input type="button" id="select_by_txt" value="确定" class="select_file">
        </div>
    </div>
    <script>
        $(".top_action a").die("click").live("click", function(){
            var $url = $(this).attr("href");
            $.ajax({
                url: $url,
                method: "POST",
                dataType: "HTML",
                success: function(html){
                    var list_content = $(html).find("#list_content");
                    $("#list_content").replaceWith(list_content);
                }
            });
            return false;
        });
        
        $("#list_menu li").click(function(){
        
            $("#list_menu li").not(this).removeClass("on");
            $(this).addClass("on");
            var tab = $(this).attr("tab");
            
            $(".panel_content").css('display', 'none');
            $("#" + tab + "_content").show();
            
            if (tab == "list") {
                $.post("/admin/admin_file/getfiles", function(data){
                    var content = $(data).find("#list_content").html();
                    $("#list_content").html(content);
                });
            }
            return false;
        });
        
        $(".delete_file").die("click").live("click", function(){
            var $this = $(this);
            $id = $(this).prev(".select_file").attr("id");
            if (confirm("确定删除吗？")) {
                $.post("/admin/admin_file/delfile", {
                    'id': $id
                }, function(data){
                    $this.parents("tr.table_list").fadeOut(300, function(){
                        $(this).remove();
                    });
                });
            }
            return false;
        });
        $("#upload_file_btn").click(function(){
            if ($("#upload_file").val() == "") {
                return false;
            }
            var $form = $(this).parents("form");
            $form.ajaxSubmit({
                success: function(data){
                    $("#file_info").html(data);
                    //$("#upload_status .busying").fadeOut(400);
                }
            });
            return false;
        });
        
        $("#link_url").change(function(){
            var $url = $(this).val();
            $("#select_by_txt").attr({
                'url': $url
            });
            return false;
        });
    </script>
</div>
<div style="clear:both">
</div>
